
TARGETS = chemnitzd chemnitz_control client version libchemnitz.a
all: $(TARGETS)

chemnitzd: chemnitzd.o libchemnitz.a
	$(CC) $(CFLAGS) -o chemnitzd chemnitzd.o $(LDFLAGS)

chemnitz_control: chemnitz_control.o libchemnitz.a
	$(CC) $(CFLAGS) -o chemnitz_control chemnitz_control.o $(LDFLAGS)

client: client.o libchemnitz.a
	$(CC) $(CFLAGS) -o client client.o $(LDFLAGS)

version: version.o libchemnitz.a
	$(CC) $(CFLAGS) -o version version.o $(LDFLAGS)

LIBCHEMNITZ_TARGETS = chemnitz.o chemnitz_socket.o chemnitz_stream.o \
											chemnitz_pool.o chemnitz_paths.o
libchemnitz.a: $(LIBCHEMNITZ_TARGETS)
	ar -r libchemnitz.a $(LIBCHEMNITZ_TARGETS)

chemnitz.o: chemnitz-$(LIBRARY).c $(INCLUDE_DIR)/chemnitz.h
	$(CC) $(CFLAGS) -c -o chemnitz.o chemnitz-$(LIBRARY).c 
chemnitz_socket.o: chemnitz_socket.c $(INCLUDE_DIR)/chemnitz_socket.h
chemnitz_pool.o: chemnitz_pool.c $(INCLUDE_DIR)/chemnitz_pool.h
chemnitz_stream.o: chemnitz_stream.c $(INCLUDE_DIR)/chemnitz_stream.h
chemnitz_paths.o: chemnitz_paths.c 
chemnitzd.o: chemnitzd.c
client.o: client.c
version.o: version.c
chemnitz_control.o: chemnitz_control.c

clean:
	rm -f $(TARGETS)
	rm -f *.gcno *.gcda *.o

